<template>
	<view class="news">
		<news-item :list="newslist" @itemClick="goDetail"></news-item>
	</view>
</template>
=""
<script>
	import newsItem from '../../components/news-item/news-item.vue'
	export default {
		data() {
			return {
				newslist: []
			}
		},
		methods: {
			//获取咨询数据
			async getNews(){
				const res = await this.$myRequest({
					url:'/api/getnewslist'
				})
				// console.log(res)
				this.newslist = res.data.message
			},
			//页面跳转
			goDetail(id){
				// console.log(id)
				uni.navigateTo({
					url:'/pages/news-detail/news-detail?id='+id
				})
			}
		},
		onLoad(){
			this.getNews()
		},
		components:{"news-item":newsItem}
	}
</script>

<style lang="scss">
	.news{
		
	}
</style>
